package flirtme.model;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import flirtme.constants.Constants;

public class CurrentUser  {
	private String password = null;
	private String username = null;
	private String userID = null;
	private String firstName = "";
	private String lastName = "";
	private String email = "";
	private String gender = "";
	private String age = "";
	private String birthDay = "00-00-00";
	private String avatarUrl = null;

	public CurrentUser(SharedPreferences sharedPref) {
		super();
		this.username = sharedPref.getString(Constants.USER_NAME_KEY, null);
		this.userID = sharedPref.getString(Constants.USER_ID_KEY, null);
		this.password = sharedPref.getString(Constants.PASSWORD_KEY, null);
		this.firstName = sharedPref.getString(Constants.USER_FIRSTNAME_KEY, null);
		this.lastName = sharedPref.getString(Constants.USER_LASTNAME_KEY, null);
		this.email = sharedPref.getString(Constants.EMAIL_KEY, null);
		this.gender = sharedPref.getString(Constants.GENDER_KEY, null);
		this.avatarUrl = sharedPref.getString(Constants.USER_AVATAR_URL_KEY, null);
		this.age = sharedPref.getString(Constants.AGE_KEY, null);
		this.birthDay = sharedPref.getString(Constants.BIRTHDAY_KEY, "00-00-00");
	}

	public CurrentUser() {
		// TODO Auto-generated constructor stub
	}

	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}

	public String getUserID() {
		return userID;
	}

	public void setUserID(String userID) {
		this.userID = userID;
	}
	
	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getAge() {
		return age;
	}

	public void setAge(String age) {
		this.age = age;
	}

	public void  updateSharedPreferences(SharedPreferences.Editor editor) {
		editor.putString(Constants.USER_NAME_KEY, this.getUsername());
		editor.putString(Constants.EMAIL_KEY, this.getEmail());
		editor.putString(Constants.USER_ID_KEY, this.getUserID());
		editor.putString(Constants.PASSWORD_KEY, this.getPassword());
		editor.putString(Constants.USER_FIRSTNAME_KEY, this.getFirstName());
		editor.putString(Constants.USER_LASTNAME_KEY, this.getLastName());
		editor.putString(Constants.GENDER_KEY, this.getGender());
		editor.putString(Constants.USER_AVATAR_URL_KEY, this.getAvatarUrl());
		editor.putString(Constants.AGE_KEY, this.getAge());
		editor.putString(Constants.BIRTHDAY_KEY, this.getBirthDay());
	}
	
	public void removeSharedPreferences(Editor editor) {
		editor.remove(Constants.USER_NAME_KEY);
		editor.remove(Constants.EMAIL_KEY);
		editor.remove(Constants.REMEMBER_USER_KEY);
		editor.remove(Constants.PASSWORD_KEY);
		editor.remove(Constants.USER_FIRSTNAME_KEY);
		editor.remove(Constants.USER_LASTNAME_KEY);
		editor.remove(Constants.GENDER_KEY);
		editor.remove(Constants.USER_AVATAR_URL_KEY);
		editor.remove(Constants.AGE_KEY);
		editor.remove(Constants.BIRTHDAY_KEY);
	}

	public String getEmail() {
		return this.email;
	}
	public void setEmail(String _email) {
		email = _email;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public String getAvatarUrl() {
		return avatarUrl;
	}

	public void setAvatarUrl(String avatarUrl) {
		this.avatarUrl = avatarUrl;
	}

	public String getBirthDay() {
		return birthDay;
	}

	public void setBirthDay(String birthDay) {
		this.birthDay = birthDay;
	}
	
}
